home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 6 / The Arsenal Files 6 (Arsenal Computer).ISO / prg_basi / ddfedit.zip / DDFNWFIL.FRM < prev    next >
Text File  |  1996-02-04  |  5KB  |  183 lines

  1. VERSION 2.00
  2. Begin Form FormNewFile 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Add New File"
  6.    ClientHeight    =   1305
  7.    ClientLeft      =   1785
  8.    ClientTop       =   2040
  9.    ClientWidth     =   4380
  10.    ControlBox      =   0   'False
  11.    Height          =   1710
  12.    Left            =   1725
  13.    LinkTopic       =   "Form3"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   1305
  17.    ScaleWidth      =   4380
  18.    Top             =   1695
  19.    Width           =   4500
  20.    Begin TextBox NewFileIDX 
  21.       Height          =   285
  22.       Left            =   240
  23.       TabIndex        =   9
  24.       Top             =   840
  25.       Visible         =   0   'False
  26.       Width           =   180
  27.    End
  28.    Begin TextBox XPath 
  29.       Height          =   285
  30.       Left            =   0
  31.       TabIndex        =   8
  32.       Top             =   840
  33.       Visible         =   0   'False
  34.       Width           =   180
  35.    End
  36.    Begin CommandButton ButOk 
  37.       Caption         =   "OK"
  38.       Default         =   -1  'True
  39.       Height          =   330
  40.       Left            =   3060
  41.       TabIndex        =   7
  42.       Top             =   900
  43.       Width           =   1230
  44.    End
  45.    Begin CommandButton butcan 
  46.       Cancel          =   -1  'True
  47.       Caption         =   "Cancel"
  48.       Height          =   330
  49.       Left            =   1485
  50.       TabIndex        =   6
  51.       Top             =   900
  52.       Width           =   1230
  53.    End
  54.    Begin SSPanel Panel3D2 
  55.       AutoSize        =   3  'AutoSize Child To Panel
  56.       BevelInner      =   1  'Inset
  57.       BevelOuter      =   0  'None
  58.       BorderWidth     =   1
  59.       Caption         =   "Panel3D1"
  60.       Height          =   285
  61.       Left            =   1485
  62.       TabIndex        =   3
  63.       Top             =   495
  64.       Width           =   2805
  65.       Begin TextBox NewFileLocation 
  66.          BorderStyle     =   0  'None
  67.          Height          =   225
  68.          Left            =   30
  69.          MaxLength       =   64
  70.          TabIndex        =   4
  71.          Top             =   30
  72.          Width           =   2745
  73.       End
  74.    End
  75.    Begin SSPanel Panel3D1 
  76.       AutoSize        =   3  'AutoSize Child To Panel
  77.       BevelInner      =   1  'Inset
  78.       BevelOuter      =   0  'None
  79.       BorderWidth     =   1
  80.       Caption         =   "Panel3D1"
  81.       Height          =   285
  82.       Left            =   1485
  83.       TabIndex        =   0
  84.       Top             =   90
  85.       Width           =   2805
  86.       Begin TextBox NewFileName 
  87.          BorderStyle     =   0  'None
  88.          Height          =   225
  89.          Left            =   30
  90.          MaxLength       =   20
  91.          TabIndex        =   1
  92.          Top             =   30
  93.          Width           =   2745
  94.       End
  95.    End
  96.    Begin Label Label2 
  97.       BackColor       =   &H00C0C0C0&
  98.       Caption         =   "&Location"
  99.       ForeColor       =   &H00FF0000&
  100.       Height          =   195
  101.       Left            =   135
  102.       TabIndex        =   5
  103.       Top             =   540
  104.       Width           =   1230
  105.    End
  106.    Begin Label Label1 
  107.       BackColor       =   &H00C0C0C0&
  108.       Caption         =   "&Name"
  109.       ForeColor       =   &H00FF0000&
  110.       Height          =   195
  111.       Left            =   135
  112.       TabIndex        =   2
  113.       Top             =   135
  114.       Width           =   1230
  115.    End
  116. End
  117. Option Explicit
  118.  
  119. Sub butcan_Click ()
  120.   Unload Me
  121. End Sub
  122.  
  123. Sub ButOk_Click ()
  124.   
  125.   Dim stat As Integer
  126.   Dim KeyNum As Integer
  127.   Dim PosBlk As PosBlkDef
  128.   Dim Keybuf As KeyBufDef
  129.   Dim KeyBufLen As Integer
  130.   Dim BufLen As Integer
  131.   Dim FileFullPath As String
  132.   Dim XDFile As XDFile_def
  133.   Dim fidx As Integer
  134.   Dim r As Integer
  135.   
  136.   NewFileName.Text = Trim(NewFileName.Text)
  137.   NewFileLocation.Text = Trim(NewFileLocation.Text)
  138.  
  139.   If NewFileName.Text = "" Then
  140.     MsgBox "No Name Supplied", , "Error Creating New File"
  141.     Exit Sub
  142.   End If
  143.  
  144.   If NewFileLocation.Text = "" Then
  145.     MsgBox "No Location Supplied", , "Error Creating New File"
  146.     Exit Sub
  147.   End If
  148.   
  149.  
  150. ' ************************************************************************************
  151. ' First Add Fields to the FILE.DDF file
  152. ' ************************************************************************************
  153.  
  154.   
  155.   FileFullPath = XPath.Text & "FILE.DDF"
  156.   Keybuf.kb = FileFullPath
  157.   KeyBufLen = Len(Keybuf)
  158.   BufLen = 0
  159.  
  160.   
  161.   status "Adding Fields to file " & FileFullPath
  162.   
  163.   stat = btrcall(B_OPEN, PosBlk, XDFile, BufLen, Keybuf, KeyBufLen, 0)
  164.   If stat <> 0 Then
  165.     MsgBox "Btrieve Error Opening file " & FileFullPath & Chr(10) & stat & " " & BtErr(stat)
  166.     Exit Sub
  167.   End If
  168.  
  169.   
  170.   r = AddRecordToFileDDF((Val(NewFileIDX.Text)), PosBlk, (NewFileName), (NewFileLocation), 0, "")
  171.   
  172.  
  173.   stat = btrcall(B_CLOSE, PosBlk, XDFile, BufLen, Keybuf, KeyBufLen, 0)
  174.   Unload Me
  175. End Sub
  176.  
  177. Sub Form_Load ()
  178.   left = (screen.Width - Width) / 2
  179.   top = (screen.Height - Height) / 2
  180.  
  181. End Sub
  182.  
  183.